<?php
namespace app\index\controller;
use think\Controller;
use app\admin\model\Course as CourseModel;

class Index extends Controller
{
    public function index()
    {
        $courses1 = CourseModel::limit(1,22)->select();
        $courses2 = CourseModel::limit(23,22)->select();
        $courses3 = CourseModel::limit(45,22)->select();
        $courses4 = CourseModel::limit(67,24)->select();

        $this->assign('courses1',$courses1);
        $this->assign('courses2',$courses2);
        $this->assign('courses3',$courses3);
        $this->assign('courses4',$courses4);
        return $this->fetch();
    }


    public function details($course_id = 0)
    {
        $course = CourseModel::get($course_id);
        //dump($course);die;
        if($course)
        {
            $this->assign('course',$course);
        } else {
            echo '非法参数！';die;
        }

        return $this->fetch();
    }

    public function select()
    {
        return $this->fetch();
    }
}
